package com.cs.cssupplier.controller;

import com.cs.cssupplier.domain.CsPersonnel;
import com.cs.cssupplier.domain.CsRiskMonitor;
import com.cs.cssupplier.mapper.CsRiskMonitorMapper;
import com.cs.cssupplier.mapper.CsWinningResultsMapper;
import com.cs.cssupplier.service.CsRiskMonitorService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：lyj
 * @Package：com.cs.cssupplier.controller
 * @Project：RuoYi-Cloud-master
 * @name：CsRiskMonitorController
 * @Date：2024/11/27 15:24
 * @Filename：CsRiskMonitorController
 */
@RestController
@RequestMapping("/riskMonitor")
public class CsRiskMonitorController extends BaseController {
    @Autowired
    private CsRiskMonitorService service;
    /**
     * 根据id查询风险管理
     * @param rm_id
     * @return
     */
    @GetMapping(value = "/{rm_id}")
    public AjaxResult RiskMonitorId(@PathVariable("rm_id")Long rm_id){
        return AjaxResult.success(service.selectCsRiskMonitor(rm_id));
    }

    /**
     * 查询所有的风险管理
     * @param csRiskMonitor
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo list(CsRiskMonitor csRiskMonitor){
        startPage();
        List<CsRiskMonitor> list=service.selectCsRiskMonitorList(csRiskMonitor);
        System.out.println(list+"大撒大撒大撒");
        return getDataTable(list);
    }

    /**
     * 添加风险管理信息
     * @param csRiskMonitor
     * @return
     */
    @PostMapping
    public AjaxResult insertCsRiskMonitor(@RequestBody CsRiskMonitor csRiskMonitor){
        return toAjax(service.insertCsRiskMonitor(csRiskMonitor));
    }

    /**
     * 修改风险管理信息
     * @param csRiskMonitor
     * @return
     */
    @PutMapping
    public AjaxResult updateRiskMonitor(@RequestBody CsRiskMonitor csRiskMonitor){
        return toAjax(service.updateCsRiskMonitor(csRiskMonitor));
    }

    /**
     * 批量删除风险管理
     * @param rm_id
     * @return
     */
    @DeleteMapping("/{rm_id}")
    public AjaxResult deleteRiskMonitor(@PathVariable Long [] rm_id){
        return toAjax(service.deleteListCsRiskMonitor(rm_id));
    }
}
